package com.trip.api.vo;

import com.trip.api.config.SystemConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author truman
 * @date 2022/8/26
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private Integer code;
    private String msg;
    private Object data;

    public static R ok(Object data) {
        return new R(SystemConfig.R_OK, "OK", data);
    }

    public static R ok() {
        return ok(null);
    }

    public static R fail(String msg) {
        return new R(SystemConfig.R_FAIL, msg, null);
    }

    public static R fail() {
        return fail("FAIL");
    }
}
